package com.example.design.pattern.behavior.chain;

public class ChainPatternDemo {

    public static AbstractLogger getChainOfLoggers(){
        
        AbstractLogger errorLogger = new ErrorLogger();
        AbstractLogger debugLogger = new DebugLogger();
        AbstractLogger infoLogger = new InfoLogger();
        
        errorLogger.setNextLogger(debugLogger);
        
        debugLogger.setNextLogger(infoLogger);
   
        return errorLogger;  
     }
    
    public static void main(String[] args) {
        AbstractLogger chain = getChainOfLoggers();
        
        chain.log(AbstractLogger.INFO, "This is an info information.");
        System.out.println();
        chain.log(AbstractLogger.DEBUG, "This is an debug information.");
        System.out.println();
        chain.log(AbstractLogger.ERROR, "This is an error information.");
    }
}
